import { request } from '@/utils/requestWrapper';
import { tokenStore } from "@/store/tokenStore";

import type { API } from '@/backend/typings.d';

const tokenStoreInstance = tokenStore();

/** 获取可购买优惠券列表 GET /api/coupon/list/canBuy */
export async function listCanBuyCouponUsingGet(
  params?: {
    current?: number;
    pageSize?: number;
  },
  options?: { [key: string]: any }
) {
  return request<API.BaseResponsePageCouponVO_>({
    url: "/api/coupon/list/canBuy",
    method: "GET",
    params: {
      current: params?.current || 1,
      pageSize: params?.pageSize || 10,
      ...params
    },
    header: {
      'Authorization': tokenStoreInstance.getToken
    },
    ...(options || {})
  });
}

/** 获取秒杀优惠券列表 GET /api/coupon/list/seckillCoupon */
export async function listSeckillCouponUsingGet(
  params?: {
    current?: number;
    pageSize?: number;
  },
  options?: { [key: string]: any }
) {
  return request<API.BaseResponsePageCouponVO_>({
    url: "/api/coupon/list/seckillCoupon",
    method: "GET",
    params: {
      current: params?.current || 1,
      pageSize: params?.pageSize || 10,
      ...params
    },
    header: {
      'Authorization': tokenStoreInstance.getToken
    },
    ...(options || {})
  });
} 